<template>
	<view style="padding: 20rpx;">
		<BuyMode zfbTitle='支付宝' :isBalance='false' :isWx='false' :isRecommend='false' v-model="buyType"></BuyMode>
		<u-button :loading='loading' style="margin-top: 80rpx;" @click="submit" type="primary">确认提现</u-button>
	</view>
</template>

<script>
	import BuyMode from '@/components/ZH-BuyMode/ZH-BuyMode.vue'
	export default {
		components: {
			BuyMode
		},
		data() {
			return {
				buyType: 2,
				loading: false,
				form: {
					money: '',
					name: '',
					alipay: ''
				},
				money: ''
			};
		},
		onLoad(e) {
			console.log(e)
			this.money = e.money
			this.init()
		},
		methods: {
			init() {
				// paymentTerm,setPaymentTerm
				this.$u.api.paymentTerm().then(res => {
					console.log(res, 'res')
					this.form = res
				})
			},
			submit() {
				const form = {
					...this.form,
					money: Number(this.money)
				}
				this.loading = true
				this.$u.api.alipayWithdrawal(form).then(res => {
					console.log(res, '提现')
					uni.showToast({
						title: '等待审核',
						icon: 'none'
					});
					uni.navigateTo({
						url: '/pages/my/balance/balance'
					})
				}).finally(f => {
					this.loading = false

				})
			}
		}
	}
</script>

<style lang="scss">

</style>
